package com.yanfan.energybilling.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yanfan.energybilling.domain.PriceSchemeTime;
import com.yanfan.energybilling.mapper.PriceSchemeTimeMapper;
import com.yanfan.energybilling.service.IPriceSchemeTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 插座价格的时间段Service业务层处理
 *
 * @author kerwincui
 * @date 2025-06-18
 */
@Service
public class PriceSchemeTimeServiceImpl extends ServiceImpl<PriceSchemeTimeMapper, PriceSchemeTime> implements IPriceSchemeTimeService
{
    @Autowired
    private PriceSchemeTimeMapper priceSchemeTimeMapper;

    /**
     * 查询插座价格的时间段
     *
     * @param id 插座价格的时间段主键
     * @return 插座价格的时间段
     */
    @Override
    public PriceSchemeTime selectPriceSchemeTimeById(Long id)
    {
        return priceSchemeTimeMapper.selectPriceSchemeTimeById(id);
    }

    /**
     * 查询插座价格的时间段列表
     *
     * @param priceSchemeTime 插座价格的时间段
     * @return 插座价格的时间段
     */
    @Override
    public List<PriceSchemeTime> selectPriceSchemeTimeList(PriceSchemeTime priceSchemeTime)
    {
        return priceSchemeTimeMapper.selectPriceSchemeTimeList(priceSchemeTime);
    }

    /**
     * 新增插座价格的时间段
     *
     * @param priceSchemeTime 插座价格的时间段
     * @return 结果
     */
    @Override
    public int insertPriceSchemeTime(PriceSchemeTime priceSchemeTime)
    {
        return priceSchemeTimeMapper.insertPriceSchemeTime(priceSchemeTime);
    }

    /**
     * 修改插座价格的时间段
     *
     * @param priceSchemeTime 插座价格的时间段
     * @return 结果
     */
    @Override
    public int updatePriceSchemeTime(PriceSchemeTime priceSchemeTime)
    {
        return priceSchemeTimeMapper.updatePriceSchemeTime(priceSchemeTime);
    }

    /**
     * 批量删除插座价格的时间段
     *
     * @param ids 需要删除的插座价格的时间段主键
     * @return 结果
     */
    @Override
    public int deletePriceSchemeTimeByIds(Long[] ids)
    {
        return priceSchemeTimeMapper.deletePriceSchemeTimeByIds(ids);
    }

    /**
     * 删除插座价格的时间段信息
     *
     * @param id 插座价格的时间段主键
     * @return 结果
     */
    @Override
    public int deletePriceSchemeTimeById(Long id)
    {
        return priceSchemeTimeMapper.deletePriceSchemeTimeById(id);
    }

    @Override
    public int deleteBySchemeId(Long schemeId) {
        return priceSchemeTimeMapper.deletePriceTimeBySchemeId(schemeId);
    }


    @Override
    public List<PriceSchemeTime> selectPriceSchemeTimeBySchemeId(Long deviceId) {
        return priceSchemeTimeMapper.selectPriceSchemeTimeBySchemeId(deviceId);
    }

    @Override
    public List<Long> selectPriceSchemeTimeNotIn(Long deviceId, List<Long> updateTimeList) {
        if(updateTimeList.isEmpty()) return new ArrayList<>();
        return priceSchemeTimeMapper.selectPriceSchemeTimeNotIn(deviceId, updateTimeList);
    }
}
